package Servlet;

import dao.Impl.ProductImpl;
import dao.ProductDao;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * ClossName:InseProductServlet
 * Pakage:Servlet
 * Description
 *
 * @Author L
 * @Create 2023/11/1 10:06
 * @Version 2023.1.3
 */
@WebServlet("/add.product")
public class InseProductServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //获取数据
        Integer id = Integer.valueOf(req.getParameter("id"));
        String name = req.getParameter("name");
        double price = Double.parseDouble(req.getParameter("price"));


        DateFormat f = new SimpleDateFormat("yyyy-MM-dd");
        String date = req.getParameter("date");


        Integer ck = Integer.valueOf(req.getParameter("box"));

        System.out.println(id);
        System.out.println(name);
        System.out.println(price);
        System.out.println(date);
        System.out.println(ck);

        //调用方法
        ProductDao productDao = new ProductImpl();


    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doGet(req,resp);
    }
}
